<?php
namespace app\admin\controller;
use x\Xbase;
class Test extends Xbase{

    //事务使用示例
    public function Init(){
        $rs = $this->db->query("select * from goods where ISNULL(goods_price_id) order by id asc limit 4");
        foreach($rs as $v){
          $rs_v = $this->db->query("select id from goods_price where goods_id=? order by id asc limit 1",[$v['id']],1);
          $this->db->update('goods',['id'=>$v['id'],'goods_price_id'=>$rs_v['id']]);
          e($v['id']);
        }
        js_url('',0.1);
    }
}
